import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/custom_list_title.dart';
import 'package:boss/ui/widget/radioList/radio.dart' as radio;
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:boss/models/material.dart' as material;

class MaterialPickerItem extends StatelessWidget {
  final material.Material data;
  final bool isSelected;
  final VoidCallback onTap;

  const MaterialPickerItem({
    Key key,
    @required this.data,
    this.isSelected = false,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomListTitle(
      onTap: onTap,
      title: RichText(
        overflow: TextOverflow.ellipsis,
        text: TextSpan(text: data.meterialName, style: TextStyleConstant().normal_1_28, children: [
          TextSpan(
            text: '      ${AmountUtil.price2String(data.meterialPrice)}元',
            style: TextStyleConstant().normal_1_28,
          )
        ]),
      ),
      trailing: radio.Radio(
        isSelected: isSelected,
      ),
    );
  }
}
